#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define MAXN 100005

int T,n,m,k;

int lg2[MAXN],a[MAXN],b[MAXN],c[MAXN];

int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]);
    }
    for(int i = 1;i <= m;i++){
        scanf("%d",&b[i]);
    }
    for(int i = 2;i <= n;i++){
        lg2[i] = lg2[i/2] + 1;
        //printf("%d %d\n",i,lg2[i]);
    }
    k = lg2[n];
    for(int i = 1;i <= k;i++){
        scanf("%d",&c[i]);
    }
    scanf("%d",&T);
    for(int i = 1;i <= T;i++){
        printf("%d\n",1);
    }


	return 0;
}
